package cn.itsource.org.domain;

import cn.itsource.basic.domain.BaseDomain;
import cn.itsource.basic.vali.Add;
import cn.itsource.basic.vali.Update;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.List;

/**
 * 实体类：部门
 */
@Data
public class Department extends BaseDomain {
    //部门编号
    @NotEmpty(groups = {Add.class},message = "部门编号不能为空！")
    private String sn;
    //部门名称
    @NotEmpty(groups = {Update.class},message = "部门名称不能为空！")
    private String name;
    //部门路径 - 不用管
    private String dirPath;
    //部门状态：1启用,0禁用
    private Integer state = 1;
    //部门经理ID
    private Long manager_id;
    //上级部门ID
    private Long parent_id;

    //部门经理信息
    private Employee manager;
    //上级部门信息
    private Department parent;

    //用于保存当前部门下是所有子部门
    //部门树最后一级没有数据就不显示
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<Department> children = new ArrayList<>();
}